<%@ page import="java.util.Date"%>
<%@ page import="message.FileWasChanged"%>
<%@ page import="serverManger.Server"%>
<%@ page import="java.io.FileInputStream" %>
<%@ page import="java.io.BufferedInputStream"  %>
<%@ page import="java.io.File"  %>
<%@ page import="java.io.IOException" %>
<%@ page import="java.util.Set" %>
<%@ page import="serverDB.*" %>
<%@ page import="serverManger.Server" %>
<%@ page import="java.util.List" %>
<%@ page import="Watcher.ChangeType" %>


<%
	int idBox = Integer.parseInt(request.getParameter("idBox"));
	String filePath;
	Set<serverDB.File> files = (Set<serverDB.File>)session.getAttribute("files");
	int fileId = Integer.parseInt(request.getParameter("idFile"));
	serverDB.File theFile =null;
	int i=0;
	for(serverDB.File f : files){
		if(i==fileId){
			theFile=f;
			break;
		}
		i++;
	}
	ConnectToDataBase connectToDataBase = ConnectToDataBase.getInst();
	Client client = connectToDataBase.regetClient((Client)session.getAttribute("client"));
	Set<Box> boxes = client.getBoxes();
	
	Box theBox=null;
	for(Box b : boxes){
		if(b.getBoxId()==idBox){
			theBox=b;
			break;
		}
	}
	Server server = Server.getServerInst();
	server.fileWasChanged(client,theFile.getFileName(),-1,0,theBox.getBoxName(),null,new FileWasChanged(theFile.getFileName(),-1,0,theBox.getBoxName(),new Date(),null,ChangeType.DELETE));
 	response.sendRedirect("showFiles2.jsp?id="+idBox);
   
%>